package com.cy.listener;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.ImageIcon;
import javax.swing.JLabel;

import com.cy.controller.MusicController;

/**
 * 音效开关监听
 * @author CY
 *
 */
public class SoundEffectListener extends MouseAdapter {

	@Override
	public void mouseClicked(MouseEvent e) {
		MusicController.playSelect();
		JLabel jl = (JLabel) e.getComponent();
		//音效开
		if(MusicController.switchoverSoundEffect()){
			jl.setIcon(new ImageIcon("image/turnon.png"));
		} else {//音效关
			jl.setIcon(new ImageIcon("image/turnoff.png"));
		}
	}

}
